<%--
  Created by IntelliJ IDEA.
  User: 谢兴鑫
  Date: 2022/4/26
  Time: 下午 02:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>添加笔记</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-3.5.1.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/ajaxForm.js"></script>
</head>
<script>
    layui.use(['form', 'laydate', 'layer'], function () {
        var form = layui.form, laydate = layui.laydate, layer = layui.layer;
        laydate.render({
            elem: '#birthday',
            type: 'date',//指定日期选择器类型 date,time,datetime
            trigger: 'click'
        });
        laydate.render({
            elem: '#entertime',
            type: 'date',//指定日期选择器类型 date,time,datetime
            trigger: 'click'
        });


        //自定义验证规则
        form.verify({
            account: function(value, item){
                var min = item.getAtztribute('lay-min');
                if(value.length >= 3){
                    return '不能超过'+2+'位数';
                }
            },
            account1: function(value, item){
                var min = item.getAttribute('lay-min');
                if(value.length >= 4){
                    return '不能超过'+3+'位数';
                }
            },
            newmobile: function(value){
                if(value.length != 3){
                    return '只能输入三位数';
                }
            },
            chineseName: function (value) {
                let pattern = /[\u4e00-\u9fa5]/;//中文验证
                let txt = pattern.test(value);

                if (value.length < 1 || !txt) {
                    return '维修设备必须要有中文';
                }
            },
            // v_pass:[/^[\s]{1,3}$/,'长度不能超过三位数'],
            numberRequiredFalse:[/(^$)|^\d+$/,'只能填写数字'],//非必填项，填了就会进行验证
            username: function (value, item) { //value：表单的值、item：表单的DOM对象
                if (!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)) {
                    return '不能有特殊字符';
                }
                if(/(^\_)|(\__)|(\_+$)/.test(value)){
                    return '首尾不能出现下划线\'_\'';
                }

            }
        });
        //监听表单提交
        form.on('submit(formbtn)', function () {
            $("#formsbt").ajaxSubmit({
                type: "post",
                url: '${pageContext.request.contextPath}/stu/addstu',
                success: function (data) {//添加成功的回调函数
                    var index = parent.layer.getFrameIndex(window.name);//获取Frame索引
                    parent.layer.close(index);//关闭当前frame
                    parent.layui.table.reload("titleStu");//可以对父窗口进行刷新
                }
            });
        });

    });
</script>
<body>
<form class="layui-form" id="formsbt">
    <div class="layui-form-item">
        <div class="layui-input-inline">
            <input type="hidden" name="stuId" id="stuId" placeholder="编号" autocomplete="off"
                   class="layui-input">
        </div>
<%--        <div class="layui-form-mid layui-word-aux">必填项</div>--%>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-inline">
            <input type="hidden" name="password" id="password"  required placeholder="密码"
                   autocomplete="off" class="layui-input" >
        </div>
<%--        <div class="layui-form-mid layui-word-aux">必填项</div>--%>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">名字</label>
        <div class="layui-input-inline">
            <input type="text" name="stuname" id="stuname"  placeholder="姓名"
                   autocomplete="off" class="layui-input" lass="layui-input" lay-verify="required|chineseName">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">毕业学校</label>
        <div class="layui-input-inline">
            <input type="text" name="middleschool" id="middleschool"  placeholder="姓名"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-inline">
            <input type="radio" name="sex" value="男" title="男" checked/>
            <input type="radio" name="sex" value="女" title="女"/>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">年龄</label>
        <div class="layui-input-inline">
            <input type="text" name="age" id="age"  placeholder="年龄"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">出生年月</label>
        <div class="layui-input-inline">
            <input type="text" name="birthday" id="birthday"  placeholder="出生年月"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">手机号码</label>
        <div class="layui-input-inline">
            <input type="text" name="phone" id="phone"  placeholder="手机号码"
                   autocomplete="off" class="layui-input" lay-verify="required|numberRequiredFalse" >
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">住址</label>
        <div class="layui-input-inline">
            <input type="text" name="addr" id="addr"  placeholder="住址"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>
<%--     查询班级--%>
    <div class="layui-form-item">
        <label class="layui-form-label">班级</label>
        <div class="layui-input-inline">
            <select name="clazz">
                <c:forEach items="${sclist}" var="e">
                    <option value="${e.classId}">${e.className}</option>
                </c:forEach>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

<%--查询宿舍--%>
    <div class="layui-form-item">
        <label class="layui-form-label">宿舍</label>
        <div class="layui-input-inline">
            <select name="huor">
                <c:forEach items="${shlist}" var="e">
                    <option value="${e.huorId}">${e.huorName}</option>
                </c:forEach>
            </select>
        </div>
<%--        <div class="layui-form-mid layui-word-aux">必填项</div>--%>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">入学时间</label>
        <div class="layui-input-inline">
            <input type="text" name="entertime" id="entertime" required lay-verify="" placeholder="入学时间"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">介绍老师</label>
        <div class="layui-input-inline">
            <input type="text" name="introduretech" id="introduretech"  placeholder="介绍老师"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">学生状态:</label>
        <div class="layui-input-block">
            <input type="radio" name="stat" title="在读" value="1" checked/>
            <input type="radio" name="stat" title="毕业" value="2"/>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">民族:</label>
        <div class="layui-input-inline">
            <input type="text" name="nation" id="nation"  placeholder="民族"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">籍贯:</label>
        <div class="layui-input-inline">
            <input type="text" name="natives" id="natives"  placeholder="籍贯"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">户口性质:</label>
        <div class="layui-input-inline">
            <input type="radio" name="residence" title="农村" value="1" checked/>
            <input type="radio" name="residence" title="城市" value="2"/>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">身份证:</label>
        <div class="layui-input-inline">
            <input type="text" name="cardid" id="cardid"  placeholder="身份证"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">就读专业:</label>
        <div class="layui-input-inline">
            <select name="professional">
                <c:forEach items="${mlist}" var="e">
                    <option value="${e.majorId}">${e.majorName}</option>
                </c:forEach>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">专业类别:</label>
        <div class="layui-input-inline">
            <select name="prolevel">
                <option value="1">中技</option>
                <option value="2">高技</option>
                <option value="3">3+2</option>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">学习类型:</label>
        <div class="layui-input-inline">
            <select name="studytype">
                <option value="1">全日制</option>
                <option value="2">函授</option>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">家长姓名:</label>
        <div class="layui-input-inline">
            <input type="text" name="parents" id="parents"  placeholder="家长姓名"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">家长电话:</label>
        <div class="layui-input-inline">
            <input type="text" name="parentsphone" id="parentsphone"  placeholder="家长电话"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">老师电话:</label>
        <div class="layui-input-inline">
            <input type="text" name="intrphone" id="intrphone"  placeholder="老师电话"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">面试人:</label>
        <div class="layui-input-inline">
            <input type="text" name="audition" id="audition"  placeholder="面试人"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">面试人建议:</label>
        <div class="layui-input-inline">
            <input type="text" name="auditionoption" id="auditionoption"  placeholder="面试人"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">是否中专:</label>
        <div class="layui-input-inline">
            <select name="isvocational">
                <option value="1">是</option>
                <option value="2">否</option>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">中专学校:</label>
        <div class="layui-input-inline">
            <input type="text" name="vocationalsch" id="vocationalsch"  placeholder="中专学校"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">中专学籍:</label>
        <div class="layui-input-inline">
            <select name="vocationalflag">
                <option value="1">已退</option>
                <option value="2">保留</option>
            </select>
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">省录取号:</label>
        <div class="layui-input-inline">
            <input type="text" name="enrollno" id="enrollno"  placeholder="省录取号"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">欠款金额:</label>
        <div class="layui-input-inline">
            <input type="text" name="qkMoney" id="qkMoney"  placeholder="欠款金额"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">录取成绩:</label>
        <div class="layui-input-inline">
            <input type="text" name="score" id="score"  placeholder="录取成绩"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">是否低保:</label>
        <div class="layui-input-block">
            <input type="checkbox" name="dibao" lay-skin="switch" lay-text="是|否" />
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">生源类型:</label>
        <div class="layui-input-inline">
            <input type="text" name="sourceType" id="sourceType"  placeholder="生源类型"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">担保人:</label>
        <div class="layui-input-inline">
            <input type="text" name="guarantee" id="guarantee"  placeholder="担保人"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">是否当兵:</label>
        <div class="layui-input-inline">
            <input type="text" name="soldier" id="soldier"  placeholder="是否当兵"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">报名号:</label>
        <div class="layui-input-inline">
            <input type="text" name="registration" id="registration"  placeholder="报名号"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">是否住校:</label>
        <div class="layui-input-block">
            <input type="checkbox" name="zhuxiao" lay-skin="switch" lay-text="是|否" />
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">备注:</label>
        <div class="layui-input-inline">
            <input type="text" name="remark" id="remark"  placeholder="备注"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">退学:</label>
        <div class="layui-input-inline">
            <input type="text" name="tuixue" id="tuixue"  placeholder="退学"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">休学:</label>
        <div class="layui-input-inline">
            <input type="text" name="xiuxue" id="xiuxue"  placeholder="休学"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">学号:</label>
        <div class="layui-input-inline">
            <input type="text" name="stuno" id="stuno"  placeholder="休学"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">是否送电脑:</label>
        <div class="layui-input-inline">
            <input type="text" name="computer" id="computer"  placeholder="是否送电脑"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">是否领用:</label>
        <div class="layui-input-inline">
            <input type="text" name="collar" id="collar"  placeholder="是否领用"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">助学金:</label>
        <div class="layui-input-inline">
            <input type="text" name="grants" id="grants"  placeholder="助学金"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">头像:</label>
        <div class="layui-input-inline">
            <input type="text" name="headImg" id="headImg"  placeholder="头像"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">编号:</label>
        <div class="layui-input-inline">
            <input type="text" name="rollId" id="rollId"  placeholder="编号"
                   autocomplete="off" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-mid layui-word-aux">必填项</div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <button id="formbtn" type="button" lay-submit lay-filter="formbtn" class="layui-btn layui-btn-normal">
            提交
        </button>
        <button id="reset" type="reset" class="layui-btn layui-btn-normal">
            重置
        </button>
    </div>


</form>
</body>
</html>

